/* About Property Sheet Class	*/
#pragma once

class CPageAboutTA : public CPropertyPageImpl<CPageAboutTA>
{
public:
	enum { IDD = IDD_ABOUTBOX };

	CPageAboutTA()
	{ 
		SetTitle(IDS_TA_ABOUT_PAGE_TA);
	}

	BEGIN_MSG_MAP(CPageOne)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		CHAIN_MSG_MAP(CPropertyPageImpl<CPageAboutTA>)
	END_MSG_MAP()

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		//Set cancel to close
		CPropertySheetWindow prSheet = GetPropertySheet();
		prSheet.CancelToClose();

		//Remove Cancel button
		RECT rect;
		CButton btnCancel = prSheet.GetDlgItem(IDCANCEL);
		btnCancel.GetWindowRect(&rect);
		prSheet.ScreenToClient(&rect);
		btnCancel.ShowWindow(SW_HIDE);

		//Reposition the OK button
		CButton btnClose = prSheet.GetDlgItem(IDOK);
		btnClose.SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOSIZE);

		//Center property sheet to program center
		prSheet.CenterWindow(GetPropertySheet().GetParent());

		//Remove ? button on the titlebar
		prSheet.ModifyStyleEx(WS_EX_CONTEXTHELP, 0);
		
		return TRUE;
	}

};

class CPageAboutContrilib : public CPropertyPageImpl<CPageAboutContrilib>
{
public:
	enum { IDD = IDD_ABOUT_CONTRILIB };


	CPageAboutContrilib()
	{
		SetTitle(IDS_TA_ABOUT_PAGE_CONTRILIB);
	}

	BEGIN_MSG_MAP(CPageTwo)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		CHAIN_MSG_MAP(CPropertyPageImpl<CPageAboutContrilib>)
	END_MSG_MAP()

	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
	{
		return TRUE;
	}
};

class CAboutPropertySheets : public CPropertySheetImpl<CAboutPropertySheets>
{
public:
	CPageAboutTA			m_pageAboutTA;
	CPageAboutContrilib		m_pageAboutContri;

	CAboutPropertySheets(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : CPropertySheetImpl(title, uStartPage, hWndParent)
	{
		//Set NO apply button
		m_psh.dwFlags |= PSH_NOAPPLYNOW;

		AddPage(m_pageAboutTA);
		AddPage(m_pageAboutContri);
	}

	BEGIN_MSG_MAP(CAboutPropertySheets)
		CHAIN_MSG_MAP(CPropertySheetImpl<CAboutPropertySheets>)
	END_MSG_MAP()
};